package com.ruoyi.web.controller.kzgl;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kzgl.domain.TbKzglJzqtj;
import com.ruoyi.kzgl.service.ITbKzglJzqtjService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 集中器统计Controller
 * 
 * @author ruoyi
 * @date 2023-11-11
 */
@RestController
@RequestMapping("/kzgl/jzqtj")
public class TbKzglJzqtjController extends BaseController
{
    @Autowired
    private ITbKzglJzqtjService tbKzglJzqtjService;

    /**
     * 查询集中器统计列表
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbKzglJzqtj tbKzglJzqtj)
    {
        startPage();
        List<TbKzglJzqtj> list = tbKzglJzqtjService.selectTbKzglJzqtjList(tbKzglJzqtj);
        return getDataTable(list);
    }

    /**
     * 导出集中器统计列表
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:export')")
    @Log(title = "集中器统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbKzglJzqtj tbKzglJzqtj)
    {
        List<TbKzglJzqtj> list = tbKzglJzqtjService.selectTbKzglJzqtjList(tbKzglJzqtj);
        ExcelUtil<TbKzglJzqtj> util = new ExcelUtil<TbKzglJzqtj>(TbKzglJzqtj.class);
        util.exportExcel(response, list, "集中器统计数据");
    }

    /**
     * 获取集中器统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:query')")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") Long ID)
    {
        return success(tbKzglJzqtjService.selectTbKzglJzqtjByID(ID));
    }

    /**
     * 新增集中器统计
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:add')")
    @Log(title = "集中器统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbKzglJzqtj tbKzglJzqtj)
    {
        return toAjax(tbKzglJzqtjService.insertTbKzglJzqtj(tbKzglJzqtj));
    }

    /**
     * 修改集中器统计
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:edit')")
    @Log(title = "集中器统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbKzglJzqtj tbKzglJzqtj)
    {
        return toAjax(tbKzglJzqtjService.updateTbKzglJzqtj(tbKzglJzqtj));
    }

    /**
     * 删除集中器统计
     */
    @PreAuthorize("@ss.hasPermi('kzgl:jzqtj:remove')")
    @Log(title = "集中器统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable Long[] IDs)
    {
        return toAjax(tbKzglJzqtjService.deleteTbKzglJzqtjByIDs(IDs));
    }
}
